package com.huawei.Galenus.service.impl;

import com.huawei.Galenus.dao.UserSongRepository;
import com.huawei.Galenus.domain.UserSong;
import com.huawei.Galenus.service.UserSongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("UserSongService")
public class UserSongServiceImpl implements UserSongService {

    @Autowired
    private UserSongRepository userSongRepository;

    @Override
    public Boolean buy(Integer uid, Integer sid) {
        UserSong userSong = new UserSong();
        userSong.setSid(sid);
        userSong.setUid(uid);
        return userSongRepository.save(userSong) == 1 ? Boolean.TRUE : Boolean.FALSE;
    }
}
